package com.xsd.composite;

/**
 * @Description: 组合模式
 * @Author: zhoufuzong
 * @Created: 2021-02-25 22:30:22
 * @Version: 1.1.0
 */

public class Client {
    public static void main(String[] args) {
        OrganizationComponent university = new University("清华大学","中国顶级大学");
        // 创建学院
        OrganizationComponent computerCollege = new College("计算机学院","计算机学院");
        OrganizationComponent infoEngineerCollege = new College("信息工程学院","信息工程学院");

        // 创建各个学院下面的系
        computerCollege.add(new Department("软件工程","软件工程不错"));
        computerCollege.add(new Department("网络工程","网络工程不错"));
        computerCollege.add(new Department("计算机科学与技术","计算机科学与技术是老牌专业"));

        //
        infoEngineerCollege.add(new Department("信息工程","信息工程不好学" ));
        infoEngineerCollege.add(new Department("通信工程","通信工程好学"));

        // 将学院加入学校
        university.add(computerCollege);
        university.add(infoEngineerCollege);

        university.print();
        computerCollege.print();

    }
}
